<!DOCTYPE HTML>
<script src="../resources/gc.js"></script>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>

<!--

Accessibility Object Model
Explainer: https://github.com/WICG/aom/blob/master/explainer.md
Spec: https://wicg.github.io/aom/spec/

-->

<input id="native-slider" type="range" min="1" max="100" value="50">
<div id="aria-slider" role="slider" aria-valuemin="1" aria-valuemax="100" aria-valuenow="50">

<script>

test(function(t) {
    assert_true(internals.runtimeFlags.accessibilityObjectModelEnabled);
}, "Make sure that Accessibility Object Model is enabled");

promise_test(async function(t) {
  var nativeElement = document.getElementById("native-slider");
  var ariaElement = document.getElementById("aria-slider");
  var nativeCaxNode = await window.getComputedAccessibleNode(nativeElement);
  var ariaCaxNode = await window.getComputedAccessibleNode(ariaElement);

  assert_equals(nativeCaxNode.valueMin, 1);
  assert_equals(ariaCaxNode.valueMin, 1);
}, "ComputedAccessibleNode.valueMin");

promise_test(async function(t) {
  var nativeElement = document.getElementById("native-slider");
  var ariaElement = document.getElementById("aria-slider");
  var nativeCaxNode = await window.getComputedAccessibleNode(nativeElement);
  var ariaCaxNode = await window.getComputedAccessibleNode(ariaElement);

  assert_equals(nativeCaxNode.valueMax, 100);
  assert_equals(ariaCaxNode.valueMax, 100);
}, "ComputedAccessibleNode.valueMax");

promise_test(async function(t) {
  var nativeElement = document.getElementById("native-slider");
  var ariaElement = document.getElementById("aria-slider");
  var nativeCaxNode = await window.getComputedAccessibleNode(nativeElement);
  var ariaCaxNode = await window.getComputedAccessibleNode(ariaElement);

  assert_equals(nativeCaxNode.valueNow, 50);
  assert_equals(ariaCaxNode.valueNow, 50);
}, "ComputedAccessibleNode.valueNow");

</script>
